import { getGoodsList } from '../../apis/goods'

Component({
    data: {
        compList: []
    },
    methods: {
        async getCompList() {
            const res = await getGoodsList({
                pageNum: 1,
                pageSize: 4
            })
            this.setData({
                compList: res.list
            })
        }
    },
    lifetimes: {
        attached: function () {
          wx.nextTick(() => { // 延迟到下一轮事件循环
            console.log('ttttttttttttt')
            //   // 在组件实例进入页面节点树时执行
            this.getCompList()
          })
        }
    }
})
